<br>
<br>
<br>
<h1 class="light">
    <?= $admin['username'] ?><span class="semi-bold"> <?= $admin['nickname'] ?></span>
</h1>
<p class="muted">上次登录：<?= time_format($admin['last_login']) ?></p>

<div class="row">
    <div class="col-md-12">
        <div id="tabs">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#basic-info" data-toggle="tab">基本信息</a>
                </li>
                <li class="">
                    <a href="#priv-info" data-toggle="tab">角色权限</a>
                </li>
            </ul>
        </div>
        <div class="tab-content">
            <div id="basic-info" class="tab-pane active">
                <div class="row ">
                    
                    <div class="col-md-5">
                        <form class="form-no-horizontal-spacing">

                        <div class="form-row">
                            <label class="form-label">状态</label>
                            <h5><?= $admin_status[$admin['status']] ?></h5>
                        </div>
                        <hr>
                        <div class="form-row">
                            <label class="form-label">昵称</label>
                            <h5><?= $admin['nickname'] ?></h5>
                        </div>
                        <hr>
                        <div class="form-row">
                            <label class="form-label">性别</label>
                            <div class="radio">
                                <? foreach($admin_gender as $k => $v): ?>
                                    <? if($admin['gender'] == $k): ?>
                                        <input type="radio" disabled="disabled" checked="checked" value="<?= $k ?>" id="<?= $k ?>">
                                    <? else: ?>
                                        <input type="radio" disabled="disabled" value="<?= $k ?>" id="<?= $k ?>">
                                    <? endif ?>
                                    <label for="<?= $k ?>"><?= $v ?></label>
                                <? endforeach ?>
                            </div>
                        </div>
                        <hr>
                        <div class="form-row">
                            <label class="form-label">邮箱</label>
                            <h5><?= $admin['email'] ?></h5>
                        </div>
                        <hr>
                        <div class="form-row">
                            <label class="form-label">创建时间</label>
                            <h5><?= time_format($admin['create_time']) ?></h5>
                        </div>
                        <hr>
                        <div class="form-row">
                            <label class="form-label">创建人</label>
                            <h5><?= $admin['create_admin_info']['nickname'] ?></h5>
                        </div>
                        <hr>
                        <div class="form-row">
                            <label class="form-label">更新时间</label>
                            <h5><?= time_format($admin['update_time']) ?></h5>
                        </div>
                        <hr>
                        <div class="form-row">
                            <label class="form-label">更新人</label>
                            <h5><?= $admin['create_admin_info']['nickname'] ?></h5>
                        </div>
                        </form>
                    </div>

                    <div class="col-md-5">
                    </div>
                </div>
            </div>

            <div id="priv-info" class="tab-pane">
                <h3>拥有 <span class="semi-bold">角色</span></h3>
                <? if($admin['roles_info']): ?>
                    <? foreach($admin['roles_info'] as $item): ?>
                        <span class="label label-info"><?= $item['name'] ?></span>
                    <? endforeach ?>
                <? endif ?>
                
                <hr>
                <? if($role_resource): ?>
                    <h3>拥有 <span class="semi-bold">权限</span></h3>
                    <table class="table table-bordered no-more-tables">
                        <thead>
                            <tr>
                                <th>程序名</th>
                                <? foreach($role_resource_group as $item): ?>
                                    <th><?= $item ?></th>
                                <? endforeach ?>
                            </tr>
                        </thead>
                        <tbody>
                            <? foreach($role_resource as $r): ?>
                                <tr>
                                    <td><?= $r['name'] ?></td>
                                    <? foreach($role_resource_group as $rg => $rgv): ?>
                                    <td>
                                        <? $col = strtolower($rg).'_priv' ?>
                                        <? if($admin['priv'][$r['resource_id']][$col] === ROLE_PRIV_ON): ?>
                                            <h4>
                                                <i class="icon-ok text-info"></i>
                                            </h4>
                                        <? else: ?>
                                            <h4>
                                                <i class="icon-remove text-error"></i>
                                            </h4>
                                        <? endif ?>
                                    </td>
                                    <? endforeach ?>
                                </tr>
                            <? endforeach ?>
                        </tbody>
                    </table>
                <? endif ?>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        // tabs
        $('#tabs').tab('show')
    });
</script>